
import java.util.Scanner;
public class gongyinshu {
    public static int gcd (int x, int y){
        while (y!= 0){
            int temp = y;
            y=x%y;
            x=temp;
    }
    return x;
}
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("请输入两个数: ");
        int x = input.nextInt();
        int y = input.nextInt();
        int result = gcd(x, y);
        System.out.println( result);
    input.close();
}}
    